# $Id: PKGBUILD 84667 2013-02-21 13:53:33Z mtorromeo $
# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgbase=python-rsa
pkgname=(python-rsa python2-rsa)
pkgver=3.1.1
pkgrel=2
_libname=rsa
pkgdesc="Pure-Python RSA implementation"
arch=(any)
url="http://stuvel.eu/rsa"
license=('BSD')
source=(http://pypi.python.org/packages/source/r/$_libname/$_libname-$pkgver.tar.gz)
makedepends=(python-distribute python2-distribute)

build() {
	cd "$srcdir/$_libname-$pkgver"
	
	rm -rf ../buildpy3; mkdir ../buildpy3
	python setup.py build -b ../buildpy3
	
	rm -rf ../buildpy2; mkdir ../buildpy2
	python2 setup.py build -b ../buildpy2
}

package_python-rsa() {
	depends=(python-pyasn1)
	
	cd "$srcdir/$_libname-$pkgver"
	rm -rf build; ln -s ../buildpy3 build
	python setup.py install --skip-build -O1 --root="$pkgdir"
	install -m0644 -D "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

package_python2-rsa() {
	depends=(python2-pyasn1)
	
	cd "$srcdir/$_libname-$pkgver"
	rm -rf build; ln -s ../buildpy2 build
	python2 setup.py install --skip-build -O1 --root="$pkgdir"
	install -m0644 -D "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
	
	find "$pkgdir/usr/bin" -type f | while read f; do mv "$f" "$f"2; done
}

sha256sums=('ed83fe80602077bcbf91d14e41558c751d76527c7b88d44394e1e2900fddb7ba')
